package com.cloud.consumer.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @Author wangy
 * @create 2021/6/16 10:31
 * @Description 使restTemplate具有负载均衡作用
 */
@Configuration
public class RestTemplateConfiguration {

    /**
     * 使restTemplate具有负载均衡作用
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

}
